#pragma once

#ifndef STABLINECHART_H
#define STABLINECHART_H

#include <QGraphicsSimpleTextItem>
#include<QtCharts>
#include <QWidget>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtCharts/QChartView>
#include <QtCharts/QLineSeries>

QT_CHARTS_USE_NAMESPACE

using namespace QtCharts;
class stabLineChart : public QChartView
{
	Q_OBJECT
public:
	explicit stabLineChart(QWidget* parent = nullptr);
	void saveAxisRange();

public slots:
	void updataChart(QVector<qreal> slot1,double slot2,double slot3);
	

protected:
	void mousePressEvent(QMouseEvent* event);
	void mouseMoveEvent(QMouseEvent* event);
	void mouseReleaseEvent(QMouseEvent* event);
	void wheelEvent(QWheelEvent* event);


private:
	int RCount[256];
	int GCount[256];
	int BCount[256];
	int channelNum;

	QPoint m_lastPoint;
	bool m_isPress = false;
	bool m_alreadySaveRange = false;
	double m_xMin, m_xMax, m_yMin, m_yMax;
	QGraphicsSimpleTextItem* m_coordItem;

};

#endif

